<!--
 * @Author: ray ray.chin@163.com
 * @Date: 2022-01-14 13:36:46
 * @LastEditors: ray ray.chin@163.com
 * @LastEditTime: 2024-06-24 14:09:00
 * @FilePath: /app-template-uni-upgrade/public/index.html
 * @Description: 首页
 * Copyright (c) 2024 by ray, All Rights Reserved.
-->
<!DOCTYPE html>
<html lang="zh-CN">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>
            <%= htmlWebpackPlugin.options.title %>
        </title>
        <link rel="stylesheet" type="text/css" href="<%= BASE_URL %>static/css/mapbox-gl.css">
        <script>
            document.addEventListener('DOMContentLoaded', function() {
                document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
            })
            var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
            document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
        </script>
        <link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
    </head>

    <body>
        <noscript>
            <strong>Please enable JavaScript to continue.</strong>
        </noscript>
        <div id="app"></div>
        <!-- built files will be auto injected -->
    </body>

    <!-- <script type="text/javascript" src="<%= BASE_URL %>static/js/moa.js"></script> -->
    <!-- 动态加载moa文件 -->
    <script type="text/javascript">
        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i = 0; i < vars.length; i++) {
                var pair = vars[i].split("=");
                if(pair[0] == variable){return pair[1];}
            }
            return(false);
        }
        // 获取链接中的userId
        function getUrlParameter(name) {
            name = name.replace(/[]/,"\[").replace(/[]/,"\[").replace(/[]/,"\\\]");
            var regexS = "[\\?&]"+name+"=([^&#]*)";
            var regex = new RegExp( regexS );
            var results = regex.exec(window.parent.location.href);
            if( results == null ) return ""; else {
                return results[1];
            }
        };
        function loadJS(url, callback) {
            var script = document.createElement('script'),
            fn = callback || function(){};
            script.type = 'text/javascript';
            // // IE
            // if(script.readyState) {
            //     script.onreadystatechange = function() {
            //         if(script.readyState == 'loaded' || script.readyState == 'complete') {
            //             script.onreadystatechange = null;
            //             fn();
            //         }
            //     };
            // } else {
            //     // 其他浏览器
            //     script.onload = function(){
            //         fn();
            //     };
            // }
            script.src = url;
            // console.log(getQueryVariable("userId"));
            console.log(getUrlParameter("userId"));
            console.log(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent));
            if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
                console.log("---加载此处----");
                document.getElementsByTagName('head')[0].appendChild(script);
            }
        }
        // loadJS('<%= BASE_URL %>static/js/xxx.js', function() {
        //     // alert(1);
        // });
    </script>

    <script type="text/javascript" src="<%= BASE_URL %>static/js/mapbox-gl.js"></script>
    <script type="text/javascript" src="<%= BASE_URL %>static/js/GeoGlobeJS.min.js"></script>
    <script type="text/javascript" src="<%= BASE_URL %>static/js/gmapx.min.js"></script>

    <% if (process.env.NODE_ENV === 'production' ) { %>
        <script>
            setInterval(function() {
                check()
            }, 2000);
            var check = function() {
                function doCheck(a) {
                    if (("" + a / a)["length"] !== 1 || a % 20 === 0) {
                        (function() {}
                        ["constructor"]("debugger")())
                    } else {
                        (function() {}
                        ["constructor"]("debugger")())
                    }
                    doCheck(++a)
                }
                try {
                    doCheck(0)
                } catch (err) {}
            };
            check();
        </script>

        <!-- <script
            id='disable-devtool'
            disable-devtool-auto
            src='https://cdn.jsdelivr.net/npm/disable-devtool'
            tk-name='ray',
            md5="070dd72385b8b2b205db53237da57200"
            url="about:blank"
        >
        </script> -->

        <!-- <script src='https://cdn.jsdelivr.net/npm/disable-devtool'></script> -->
        <script src='<%= BASE_URL %>static/js/disable-devtool.min.js'></script>
        <script>
            DisableDevtool({
                url: 'about:blank',
                timeOutUrl: 'about:blank',
                disableMenu: false,
                tkName: 'ray',
                md5: "070dd72385b8b2b205db53237da57200",
                ondevtoolopen(type, next){
                    // alert('Devtool opened with type:' + type);
                    var ht = document.getElementById('app');
                    ht.innerHTML = "<h1>检测到非法调试,请关闭后刷新重试</h1>"
                    alert('检测到非法调试,请关闭后刷新重试');
                    next();
                }
            })
        </script>
    <% } %>
</html>